<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%include("/back/_include/meta.html",{"title":""}){}%>
    <%include("/back/_include/style.html"){}%>
    <link href="/assets/ui/h+/css/plugins/iCheck/custom.css" rel="stylesheet">
    <style>
        .loginscreen{
            box-shadow: 0 0 10px rgba(41, 51, 55, 0.1);
            padding-bottom: 30px;
            padding-left: 30px;
            padding-right: 30px;
        }
        .loginscreen.middle-box{
            width: auto;
        }
    </style>
</head>
<body class="gray-bg" style="padding-top: 200px">
<div class="middle-box text-center loginscreen animated fadeInDown">
    <div>
        <div>
            <h1 class="logo-name" style="font-size: 140px">优&nbsp;贴</h1>
        </div>
        <h3>欢迎使用</h3>
        <form class="m-t" role="form" id="loginForm">
            <div class="form-group text-left">
                <label>账号</label>
                <input type="text" id="account" name="account" class="form-control" required="" minlength="2" maxlength="10">
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 2~10个字符以内</span>
            </div>
            <div class="form-group text-left">
                <label>密码</label>
                <input type="password" id="password" name="password" class="form-control" required="" minlength="6" maxlength="16">
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 6~16个字符以内</span>
            </div>
            <div class="text-left">
                <label>
                    <input type="checkbox" id="autoLogin" class="i-checks">
                    自动登录
                </label>
            </div>
            <div>
                <button class="btn btn-sm btn-primary block full-width m-b">
                    <strong>登录</strong>
                </button>
            </div>
        </form>
    </div>
</div>
<%include("/back/_include/script.html"){}%>
<script src="/assets/ui/h+/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/assets/ui/h+/js/plugins/validate/messages_zh.min.js"></script>
<script src="/assets/ui/h+/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $.validator.setDefaults({
        submitHandler: function() {
            var account = $$('#account')
            var password = $$('#password')
            post("/b/login/doLogin",{"account":account,"password":password,"autoLogin":$('#autoLogin').prop("checked")},function (res) {
                if(!res.success){
                    error(res.msg)
                    return;
                }
                msg("登录成功,跳转中...");
                window.location.href = window.location.href="/b";
            },function () {
                systemErr();
            })
        }
    });
    $(function () {
        $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green",})
        $("#loginForm").validate({
            messages: {
                account: {required:"请输入账号", minlength:"账号必须2个字符以上"},
                password: {required:"请输入密码", minlength:"密码必须6个字符以上"},
            }
        })
    });
</script>
</body>
</html>